<script type="text/javascript" src="<?=$this->baseUrl()?>/js/jquery.cookie.js"></script>
<script type="text/javascript">
    $(document).ready(function(){
        $("a#link").click(function(){
            $.cookie('prevpage', 'rejected');
        });
    });
    
    function del(shopId, name){
        if(!confirm('Hapus ' + name + '?')) return;

        document.frmDelete.shopId.value = shopId;
        document.frmDelete.shopName.value = name;
        document.frmDelete.submit();
    }
</script>
<div id="view-content">
    <table>
        <tr class="top">
            <td colspan="6" style="text-align:right;">
                <img style="margin-bottom:-3px;margin-top:4px;" src="<?php echo $this->baseUrl(); ?>/images/icons/tick.png" /> = Setujui &nbsp;&nbsp;&nbsp;
                <img style="margin-bottom:-3px;margin-top:4px;" src="<?php echo $this->baseUrl(); ?>/images/icons/cross.png" /> = Hapus
            </td>
        </tr>
        <tr class="head">
            <td>Nama Toko</td>
            <td>Nama Pemilik</td>
            <td>Alasan</td>
            <td>Aksi</td>
        </tr>
        <?php
        foreach ($this->shops as $shop) {
        ?>
        <tr style="background-color: <?= $this->cycle(array("#ccffcc","#99ff99"))->next(); ?>;">
            <td>
                <a id="link" href="<?php echo $this->url(array("controller" => "shop", "action" => "details", "id" => $this->escape($shop["shop_id"]))); ?>">
                    <?php echo $this->escape($shop["name"]); ?>
                </a>
            </td>
            <td>
                <?php echo $this->escape($shop["owner"]); ?></td>
            <td>
                <?php echo $this->escape($shop["reject_reason"]); ?>
            </td>
            <td>
                <a href="<?=$this->url(array("controller"=>"shop","action"=>"edit","id"=>$shop["shop_id"]))?>" title="Setujui">
                    <img src="<?php echo $this->baseUrl(); ?>/images/icons/tick.png" alt="Setujui" />
                </a>&nbsp;
                <a href="javascript: del(<?php echo $this->escape($shop["shop_id"]); ?>,'<?php echo $this->escape($shop["name"]); ?>');" title="Hapus">
                    <img src="<?php echo $this->baseUrl(); ?>/images/icons/cross.png" alt="Hapus" />
                </a>
            </td>
        </tr>
        <?php
                }
        ?>
    </table>
    <?php
        // navigator
        echo $this->back;
        echo $this->current;
        echo $this->next;
    ?>
    <div id="hiddenform" style="display:none;">
        <form name="frmDelete" action="rejected" method="POST">
            <?php echo $this->formHidden("shopId","0"); ?>
            <?php echo $this->formHidden("shopName",""); ?>
            <?php echo $this->formHidden("delete","Hapus"); ?>
        </form>
    </div>
</div>